using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class AT2_AuditMap : EntityTypeConfiguration<AT2_Audit>
    {
        public AT2_AuditMap()
        {
            // Primary Key
            this.HasKey(t => t.ID);

            // Properties
            this.Property(t => t.Type)
                .IsFixedLength()
                .HasMaxLength(1);

            this.Property(t => t.TableName)
                .HasMaxLength(128);

            this.Property(t => t.PK)
                .HasMaxLength(1000);

            this.Property(t => t.FieldName)
                .HasMaxLength(128);

            this.Property(t => t.OldValue)
                .HasMaxLength(1000);

            this.Property(t => t.NewValue)
                .HasMaxLength(1000);

            // Table & Column Mappings
            this.ToTable("AT2_Audit");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.Type).HasColumnName("Type");
            this.Property(t => t.TableName).HasColumnName("TableName");
            this.Property(t => t.PK).HasColumnName("PK");
            this.Property(t => t.FieldName).HasColumnName("FieldName");
            this.Property(t => t.OldValue).HasColumnName("OldValue");
            this.Property(t => t.NewValue).HasColumnName("NewValue");
            this.Property(t => t.UpdateDate).HasColumnName("UpdateDate");
            this.Property(t => t.UserID).HasColumnName("UserID");
        }
    }
}
